import { reactive, onMounted } from 'vue'
import axios from 'axios'

export default () => {
    let dogList = reactive([
        'https://images.dog.ceo/breeds/pembroke/n02113023_4373.jpg'
    ])
    const getDog = async () => {
        try {
            let result = await axios.get('https://dog.ceo/api/breed/pembroke/images/random')
            dogList.push(result.data.message)
        } catch (error) {
            console.log(error)
        }
    }
    onMounted(() => getDog())
    return { dogList, getDog }
}